//正则注册器
function BasicVtype_main() {
    return {
        dClick: function (cmp, r) {
            BasicVtype_form().view({
                entityId: r.get('id')
            });
        },
        id: 'BasicVtype_main',
        xtype: 'jgrid',
        clazz: BasicVtype,
        order: [],
        where: [],
        top: [{
            fieldLabel: '正则vtype',
            xtype: 'textfield',
            name: 'vtypeType',
            op: 'like'
        }, {
            xtype: 'textfield',
            name: 'vtypeName',
            op: 'like'
        }, $.search, '->', {
            key: 'A',
            iconCls: ion.add,
            text: '添加正则',
            handler: function () {
                BasicVtype_form().save({
                    grid: ['BasicVtype_main']
                });
            }
        }, {
            key: 'E',
            iconCls: ion.edit,
            text: '修改正则',
            handler: function () {
                BasicVtype_form().edit({
                    grid: ['BasicVtype_main']
                });
            }
        }, {
            key: 'D',
            iconCls: ion.del,
            text: '删除正则',
            handler: function () {
                $('BasicVtype_main').deletes({
                    validate: []
                });
            }
        }],
        columns: [
            {
                text: '正则vtype',
                "name": "vtypeType",
                width: 240
            },
            {
                text: '正则名称',
                width: 240,
                "name": "vtypeName"
            },
            {
                text: '正则表达式',
                width: 450,
                "name": "vtypeRex"
            },
            {
                text: '错误提示',
                "name": "errorMsg",
                flex: 1
            }
        ]
    }
}

function BasicVtype_form() {
    return $({
        xtype: 'jform',
        clazz: BasicVtype,
        width: 500,
        fieldsSize: 1,
        hides: [],
        //验证
        validate: [
            ['vtypeType = ?', 'vtypeType', '已存在的vtype'],
            ['vtypeName = ?', 'vtypeName', '已存在的正则名称']
        ],
        defaults: {
            lw: 100
        },
        fields: [
            {
                text: "正则vtype",
                req: true,
                "name": "vtypeType"
            },
            {
                req: true,
                "name": "vtypeName"
            },
            {
                req: true,
                "name": "errorMsg",
                xtype: 'textarea'
            },
            {
                req: true,
                "name": "vtypeRex",
                xtype: 'textarea'
            }
        ]
    })
}